import struct
import socket
import time

packs = struct.Struct('d')
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(('0.0.0.0', 8200))
# server.connect(('139.155.181.21', 6581))
text = 'd' * 512
text = text.encode()
# print(len(text))
while True:
    try:
        server.sendto(text, ('139.155.181.21', 6581))
        nowTime = time.time()
        data, ppp = server.recvfrom(1024)
        print((time.time() - nowTime) * 1000)
    except KeyboardInterrupt:
        break
